﻿using System.Collections.Generic;
using System.Runtime.Serialization;
using GeoRef;

namespace TripLOA.WebService.Serializable
{
    /// <summary>
    /// Class that represents a WebService GeoTrip: a serializable sequence of GeoRef trips. 
    /// </summary>
    [DataContract]
    public class WSGeoTrip : WSObject
    {
        #region Costructors

        /// <summary>
        /// Parameterless Costructor. Set status to "fail"
        /// </summary>
        public WSGeoTrip()
            : this("fail")
        { }

        /// <summary>
        /// Default Costructor. Set status to given value
        /// </summary>
        /// <param name="status">Status string, accepted values are "ok" or "fail"</param>
        public WSGeoTrip(string status)
        {
            this.Status = status;
            this.Payload = new List<GeoTrip>();
        }
        /// <summary>
        /// Costructor. Adds to the payloada GeoRef.GeoTrip
        /// </summary>
        /// <param name="status">Status string, accepted values are "ok" or "fail"</param>
        /// <param name="gt">GeoRef.GeoTrip object</param>
        public WSGeoTrip(string status, GeoTrip gt)
            : this(status)
        {
            this.Payload.Add(gt);
        }

        #endregion

        #region Properties

        /// <summary>
        /// Payload contains a list of GeoTrip objects
        /// </summary>
        [DataMember]
        public List<GeoTrip> Payload { get; set; }

        #endregion
    }
}
